package com.fick.filter;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

public class OnlineCountListener implements HttpSessionListener {

	private int count = 0;

	@Override
	public void sessionCreated(HttpSessionEvent se) {
		count++;
		se.getSession().getServletContext().setAttribute("OnlineCount", count);
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent se) {
		count--;
		if (count <= 0) {
			count = 1;
		}
		se.getSession().getServletContext().setAttribute("OnlineCount", count);
	}

}
